/**
 * 
 */
package com.wegax.finprod.processor.init;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author wegax
 * 
 */
public class GlobalContext {

	private static AnnotationConfigApplicationContext CTX;

	public static void initContext() {
		CTX = new AnnotationConfigApplicationContext(ProcessorInfrastructureConfiguration.class);
	}

	public static void destroyContext() {
		CTX.close();
	}

	private GlobalContext() {

	}

	/**
	 * Returnes bean of a given class
	 * 
	 * @param clazz
	 * @return
	 */
	public static <T> T getBean(Class<T> clazz) {
		return CTX.getBean(clazz);
	}
}
